﻿using System.Windows;

namespace VisualWip.TFS2010PersistanceProvider
{
    /// <summary>
    /// Interaction logic for SaveDialog.xaml
    /// </summary>
    public partial class SaveDialog
    {
        public SaveDialog()
        {
            InitializeComponent();
        }

        private void okClick(object sender, RoutedEventArgs e)
        {
            var saveViewModel = DataContext as SaveDialogViewModel;
            if (saveViewModel != null && saveViewModel.IsReplacing)
            {
                MessageBoxResult result =
                    MessageBox.Show(string.Format("Do you really want to replace {0}?", saveViewModel.Path), "Replace?",
                                    MessageBoxButton.YesNo);
                if (result == MessageBoxResult.Yes)
                {
                    DialogResult = true;
                }

                return;
            }

            DialogResult = true;
        }
    }
}